#!/bin/bash
echo `date`
echo ' check_process.sh start'

cd /home/rancher/fengwei/api

function check(){
    process_name="parse_data"

    count=`ps -ef |grep $process_name |grep -v "grep" |wc -l`
    echo $count
    if [ 0 == $count ];then
        nohup java -jar parse_data-1.0-SNAPSHOT.jar --spring.profiles.active=prod > parse_prod.log 2>&1 &
    else
        # 杀死进程
        echo "process has running"
    fi
}

check

echo 'end'
